package org.bultreebank.index.schema.management.impl;

import org.bultreebank.index.utils.Constants;

/**
 * Data model representing a context field 
 * @author Aneliya Tincheva
 *
 */
public class SearchEngineField implements Constants
{
	private String name;
	private boolean retrievable;
	private boolean searchable;
	private String xpath;
	private boolean isKeyword;
	
	public SearchEngineField(String name, String retrievable,
			 String searchable, String keyword, String xpath ) {
		this.name = name;
		this.xpath = xpath;
		if (keyword.equals(YES))
			this.isKeyword = true;
		else 
		{
			isKeyword = false;
			if (retrievable.equals(YES))
				this.retrievable = true;
			else 
				this.retrievable = false;
			if (searchable.equals(YES))
				this.searchable = true;
			else 
				this.searchable = false;
		}
	}
	public String getName()
	{
		return name;
	}
	public boolean IsRetrievable()
	{
		return retrievable;
	}
	public boolean IsKeyword()
	{
		return isKeyword;
	}
	public boolean IsSearchable()
	{
		return searchable;
	}
	public String getXPath()
	{
		return xpath;
	}
	@Override
	public String toString()
	{
		return "Name: " +  name + " ," + "Xpath: " +  xpath + " ," +
			"Is retrievable: " + retrievable + " ," + 
			"Is searchable: " + searchable + " ," +
			"Is keyword: " + isKeyword + " ,";
	}
}
